﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Scoreboard.Model;
using System.Globalization;
using Scoreboard.Basement.ViewModels;

namespace Scoreboard.Rating
{
	public class PlayerViewModel : ViewModelBase
	{
		const string ValstaffUriFormat = "http://valstaff/EmployeeInfo.aspx?EmployeeID={0}";

		private User _user;

		public PlayerViewModel(User user)
		{
			_user = user;
		}

		public string Name
		{
			get
			{
				return _user.FriendlyName;
			}
		}

		public int RatingValue
		{
			get
			{
				return _user.RatingValue;
			}
		}

		public int Position { get; set; }

		public string ValstaffUri
		{
			get
			{
				return string.Format(CultureInfo.CurrentCulture, ValstaffUriFormat, _user.EmployeeId);				
			}
		}

		public bool HasValstaffPage
		{
			get
			{
				return !string.IsNullOrWhiteSpace(_user.EmployeeId);
			}
		}

		public bool IsCurrent
		{
			get
			{
				return _user.IsCurrent;
			}
		}

		public void NotifyCurrentUserChanged()
		{
			FirePropertyChanged("IsCurrent");
		}
	}
}
